package com.example.clxy.controller;


import com.example.clxy.entity.Specialty;
import com.example.clxy.interceptor.AppToken;
import com.example.clxy.result.PageResult;
import com.example.clxy.result.WebRestResult;


import com.example.clxy.result.business.PageResult.SpecialtyPageResult;
import com.example.clxy.service.SpecialtyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Hsieh
 * @title: SpecialtyController
 * @projectName clxy
 * @description:
 * @date 2020/8/139:43
 */
@AppToken
@CrossOrigin
@RestController
@RequestMapping("SpecialtyController")
public class SpecialtyController {
    @Autowired
    SpecialtyService specialtyService;


    @PostMapping("addSpecialty")
    public WebRestResult addSpecialty(@RequestBody Specialty specialty){
        WebRestResult result=specialtyService.addSpecialty(specialty);
        return result;
    }


    @PostMapping("deleteSpecialty")
    public WebRestResult deleteSpecialty(String specialtyid){
        WebRestResult result=specialtyService.deleteSpecialty(specialtyid);
        return result;
    }


    @PostMapping("updateSpecialty")
    public WebRestResult updateSpecialty(@RequestBody Specialty specialty){
        WebRestResult result=specialtyService.updateSpecialty(specialty);
        return result;
    }


    @RequestMapping("getSpecialtybyname")
    public PageResult<SpecialtyPageResult> getSpecialtybyname(String specialtyname, int page, int pagesize){
        PageResult<SpecialtyPageResult> result=specialtyService.getSpecialtybyname(specialtyname,page,pagesize);
        return result;
    }


    @RequestMapping("getSpecialtybyid")
    public PageResult<SpecialtyPageResult> getSpecialtybyid(String specialtyid,int page, int pagesize){
        PageResult<SpecialtyPageResult> result=specialtyService.getSpecialtybyid(specialtyid,page,pagesize);
        return result;
    }

    @PostMapping("SpecialtybindWlclass")
    public WebRestResult SpecialtybindWlclass(String specialtyid,String wlclassid){
        WebRestResult result = specialtyService.SpecialtybindWlclass(specialtyid,wlclassid);
        return result;
    }
}
